package com.home.customtest.entity;

import com.custom.action.core.annotations.DbJoinField;
import com.custom.action.core.annotations.DbJoinTable;
import com.custom.action.core.annotations.DbNotField;
import com.custom.action.core.annotations.DbTable;
import com.home.customtest.enums.SexEnum;
import lombok.*;

/**
 * @author  Xiao-Bai
 * @since  2022/3/29 22:52
 * @desc:
 */
@EqualsAndHashCode(callSuper = true)
@Getter
@Setter
@ToString(callSuper = true)
@DbJoinTable("left join city lo on lo.id = a.area_id")
@DbTable(value = "student")
public class ChildStudent extends Student {



    @DbNotField
    private Integer sumAge;
    @DbNotField
    private Integer ifNullAge;
    @DbNotField
    private Integer countAge;
    @DbNotField
    private Integer minAge;
    @DbNotField
    private Integer maxAge;
    @DbNotField
    private Integer avgAge;
    @DbNotField
    private String caseAge;

//    private Integer age;

    private ChildStudent(){
        super();
    }

    public ChildStudent(int age) {
        this.avgAge = age;
        super.setAge(age);
    }

    @DbJoinField("lo.`name`")
    private String cityName;

    @DbNotField
    private SexEnum sexInfoEnum;

    @DbNotField
    private String areaTestName;

//    @Override
//    protected void queryAfter(JdbcDao jdbcDao) {
//        super.queryAfter(jdbcDao);
//        this.sexInfoEnum = SexEnum.findByInt(getSex() ? 0 : 1);
//    }
//
//    @Override
//    protected void insertAfter(JdbcDao jdbcDao) {
//        super.insertAfter(jdbcDao);
//        this.sexInfoEnum = SexEnum.findByInt(getSex() ? 0 : 1);
//    }
}
